////////////////////////////////////////////////////////////////////////////////
///////// Inflexibility and Corporate Credit Spreads ///////////////////////////
///////// Zhe An, Abe de Jong, Ying Xia, Zhaofeng Xu ///////////////////////////
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
* Date: May 5, 2025
* This do file contains code generating results for Tables 1 to 2
* Please define the path for datasets and the path for storing results before running the following program. 
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////

********************************************************************************
* Table 1 Summary Statistics
********************************************************************************

* Starting with the baseline sample 
* [Baseline_sample]

use "Path\Baseline_sample.dta", clear

tabstat credit_spread inflex20  long_term_debt operating tot_debt int_coverage  ret_bps ret_var_percent c_rating neg_VaR_5_percent illiq,  statistics (count mean sd p25 median p75) column(statistics) 

********************************************************************************

********************************************************************************
* Table 2 Inflexibility and Corporate Credit Spreads
********************************************************************************

* Use the baseline sample 
* [Baseline_sample]

use "Path\Baseline_sample.dta", clear

* Model 1
reghdfe credit_spread inflex20 , noabsorb  cluster(GVKEY year)
estimates store a1, title(Model 1)
* Model 2
reghdfe credit_spread inflex20 , absorb(qtr)  cluster(GVKEY year)
estimates store a2, title(Model 1)
* Model 3
reghdfe credit_spread inflex20 , absorb(issue_id)  cluster(GVKEY year)
estimates store a3, title(Model 1)
* Model 4
reghdfe credit_spread inflex20 , absorb(issue_id qtr)  cluster(GVKEY year)
estimates store a4, title(Model 1)
* Model 5
reghdfe credit_spread inflex20 long_term_debt operating tot_debt int_cov1 int_cov2 int_cov3 ret_bps ret_var_percent c_rating  neg_VaR_5_percent illiq , absorb(issue_id qtr)  cluster(GVKEY year)
estimates store a5, title(Model 1)

esttab a1 a2 a3 a4 a5 using "Path\Table_2.csv", b(3) t(3) scalars(r2 r2_a)  plain replace nogaps
est clear

********************************************************************************

////////////////////////////////////////////////////////////////////////////////
* The above codes generate the result, and the format of table is finalised in Excel. 

////////////////////////////////////////////////////////////////////////////////

